/**
 * 
 */
package de.cbf.cam.dsa.model.entities.states.stateChanger;

import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.entities.OneAttribute;
import de.cbf.cam.dsa.model.entities.OneNPC;

/**
 * @author Nebelritter
 *
 */
public class StateChangerAttribute extends StateChangerBase {
	/**
	 * @uml.property  name="attributeName"
	 */
	protected String attributeName;
	/**
	 * @uml.property  name="value"
	 */
	protected int value;
	/**
	 * @uml.property  name="recalcDependantValues"
	 */
	protected boolean recalcDependantValues;
//========================
//		constructors
//========================

	public StateChangerAttribute(String attributeName, int value,
			boolean recalcDependantValues) {
		super();
		this.attributeName = attributeName;
		this.value = value;
		this.recalcDependantValues = recalcDependantValues;
	}

//========================
//		   public methods
//========================

	@Override
	public void changeState(OneNPC character) {
		OneAttribute attribute = character.getAttribute(attributeName);
		attribute.setCurrentValue(attribute.getCurrentValue()+value);
		if(recalcDependantValues){
			character.calcBaseValues(false);
		}
	}
	
	@Override
	public void changeStateBattle(BattleChar character) {
		changeState(character.getCharacter());
	}

	/**
	 * @return
	 * @uml.property  name="attributeName"
	 */
	public String getAttributeName() {
		return attributeName;
	}

	/**
	 * @param attributeName
	 * @uml.property  name="attributeName"
	 */
	public void setAttributeName(String attributeName) {
		this.attributeName = attributeName;
	}

	/**
	 * @return
	 * @uml.property  name="value"
	 */
	public int getValue() {
		return value;
	}

	/**
	 * @param value
	 * @uml.property  name="value"
	 */
	public void setValue(int value) {
		this.value = value;
	}

	/**
	 * @return
	 * @uml.property  name="recalcDependantValues"
	 */
	public boolean isRecalcDependantValues() {
		return recalcDependantValues;
	}

	/**
	 * @param recalcDependantValues
	 * @uml.property  name="recalcDependantValues"
	 */
	public void setRecalcDependantValues(boolean recalcDependantValues) {
		this.recalcDependantValues = recalcDependantValues;
	}

//========================
//    standard methods
//========================

//========================
// 	   private methods
//========================

//========================
// 	SHORT property access
//========================

//========================
//		getters
//========================

//========================
//		setters
//========================

//========================
//		listeners
//========================

}
